/*
* @Author:xian
* @Date:   2017-11-03 15:38:09
* @Last Modified by:   Administrator
* @Last Modified time: 2017-11-23 13:53:01
*/

$(function(){

$("footer").load("layout/footer.html");
$(".ziying").load("layout/ziying.html");
$(".bianlijie").load("layout/bianlijie.html");
$("header").load("layout/header.html");


$(document).on(" click ",".li-right",function(){
   alert("111");
   console.log("222")
})
  
 var gongsihuo=$('#gongsihuo').html();
 var bannerHtml=$('#banner').html();
 var jingjiaxuqiuHtml=$('#jingjiaxuqiu').html();
 var touziHtml=$('#touzi').html();
 var ad4Html=$('#ad4').html();
 var eightclassHtml=$('#eightclass').html();
 var ziyingHtml=$('#ziying').html();
 var bianlijieHtml=$('#bianlijie').html();
 // 公司货
   $(function() {
              $.ajax({
                       type:"get",
                       url:"data/data.json",
                       async:true,
                       success: function(data){
                        console.log(data.gongsihuo);
                        var gongsihuodata=data.gongsihuo
                        $('.keywords-list').html(doT.template(gongsihuo)(gongsihuodata));
                       },
                       error: function(XMLHTTPRequest, textStatus, errorThrown){
                         console.log("XMLHttpRequest :"+ XMLHTTPRequest);
                         console.log("textStatus :"+textStatus);
                         console.log("errorThrown :"+errorThrown);
                       }
                     });
             
       
    });
   // 轮播图
    $(function() {
              $.ajax({
                       type:"get",
                       url:"/SST/u/lunbotu.do",
                       async:true,
                       success: function(data){
                        console.log(JSON.parse(data).banner);
                        var banner=JSON.parse(data).banner;
                        $('.banner').html(doT.template(bannerHtml)(banner));
                           var swiper = new Swiper('.swiper-container', {
                              pagination: '.swiper-pagination',
                              nextButton: '.swiper-button-next',
                              prevButton: '.swiper-button-prev',
                              slidesPerView: 1,
                              paginationClickable: true,
                              spaceBetween: 30,
                              loop: true
                            });
                       },
                       error: function(XMLHTTPRequest, textStatus, errorThrown){
                         console.log("XMLHttpRequest :"+ XMLHTTPRequest);
                         console.log("textStatus :"+textStatus);
                         console.log("errorThrown :"+errorThrown);
                       }
                     });
                
    });
    // 竞价热门需求
    $(function() {
              $.ajax({
                       type:"get",
                       url:"/SST/u/xuqiu.do",
                       async:true,
                       success: function(data){
                        console.log(JSON.parse(data).xuqiu);
                        var xuqiudata=JSON.parse(data).xuqiu
                        $('.remenxuqiu-list').html(doT.template(jingjiaxuqiuHtml)(xuqiudata));
                       },
                       error: function(XMLHTTPRequest, textStatus, errorThrown){
                         console.log("XMLHttpRequest :"+ XMLHTTPRequest);
                         console.log("textStatus :"+textStatus);
                         console.log("errorThrown :"+errorThrown);
                       }
                     });
             
       
    });
     //投资
    $(function() {
              $.ajax({
                       type:"get",
                       url:"/SST/u/touzi.do",
                       async:true,
                       success: function(data){
                        console.log(JSON.parse(data).touzi);
                        var touzidata=JSON.parse(data).touzi
                        $('.touzi-contentlist').html(doT.template(touziHtml)(touzidata));
                       },
                       error: function(XMLHTTPRequest, textStatus, errorThrown){
                         console.log("XMLHttpRequest :"+ XMLHTTPRequest);
                         console.log("textStatus :"+textStatus);
                         console.log("errorThrown :"+errorThrown);
                       }
                     });
             
       
    });

     //4个小广告
    $(function() {
              $.ajax({
                       type:"get",
                       url:"/SST/u/guanggao.do",
                       async:true,
                       success: function(data){
                        console.log(JSON.parse(data).ad4);
                        var ad4data=JSON.parse(data).ad4
                        $('.adlists').html(doT.template(ad4Html)(ad4data));
                       },
                       error: function(XMLHTTPRequest, textStatus, errorThrown){
                         console.log("XMLHttpRequest :"+ XMLHTTPRequest);
                         console.log("textStatus :"+textStatus);
                         console.log("errorThrown :"+errorThrown);
                       }
                     });
             
       
    });

   
    // 八大分类
    $(function() {
              $.ajax({
                       type:"get",
                       url:"/SST/u/fenlei.do",
                       async:true,
                       success: function(data){
                        console.log(JSON.parse(data).eightclass);
                        var eightclassdata=JSON.parse(data).eightclass
                        $('.caselists').html(doT.template(eightclassHtml)(eightclassdata));
                       },
                       error: function(XMLHTTPRequest, textStatus, errorThrown){
                         console.log("XMLHttpRequest :"+ XMLHTTPRequest);
                         console.log("textStatus :"+textStatus);
                         console.log("errorThrown :"+errorThrown);
                       }
                     });
             
       
    });


// 点击事件
    $(document).on("click" ,".search-top li",function(){
                  $(this).addClass("cur").siblings().removeClass("cur")
    })
// 点击事件
    $(document).on("click" ,".telnum",function(){
         
            alert("请用手机拨打:18788442369")
    })


})
